import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import Pagination from "@/components/Pagination";
import 'default-passive-events'
import './assets/theme/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters
// 引入api接口
import api from '@/api'


// 引入vue-amap（高德地图）
import VueAMap from 'vue-amap';
Vue.use(VueAMap);

// 初始化vue-amap
VueAMap.initAMapApiLoader({
  // 高德的key
  key: '160cab8ad6c50752175d76e61ef92c50',
  // 插件集合
  plugin: [
    'AMap.PlaceSearch', 'AMap.Scale', 'Geocoder'
  ],
  // 高德 sdk 版本，默认为 1.4.4
  v: '1.4.4'
});


// 全局组件
import FormTitle from "./components/ZtcFormTitle/index.vue";
Vue.component('formTitle', FormTitle)  //全局注册 formTitle

Vue.component('pagination', Pagination)  //全局注册 pagination
Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})
Vue.prototype.$api = api
// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
